from urllib.request import urlopen
import re

# 获取网页内容
def getHtml():
    url="https://mofanpy.com/static/scraping/basic-structure.html"
    # if has Chinese, apply decode()
    html = urlopen(
        url
    ).read().decode('utf-8')
    # print(html)
    return html


# 使用正则匹配网页内容
def getByRe():
    html=getHtml()
    res = re.findall(r"<title>(.+?)</title>", html)
    print("\nPage title is: ", res[0])


def getRuankao():
    html=urlopen("http://www.shaanxirk.com/rk/f/cms/article/two/11ce347069b6410faabf9dbdcb44a47e").read().decode('utf-8')
    # print(html)
    res = re.findall(r"<title>(.+?)</title>", html)
    print("\nPage title is: ", res[0])


if __name__ == '__main__':
    #getByRe()
    getRuankao()